import request from '@/utils/request'

export function add(data) {
  return request({
    url: '/oauth/role/add',
    method: 'post',
    data
  })
}

export function del(id) {
  return request({
    url: '/oauth/role/delete',
    method: 'post',
    data: [id]
  })
}

export function edit(data) {
  return request({
    url: '/oauth/role/update',
    method: 'post',
    data
  })
}

export function get(id) {
  return request({
    url: '/oauth/role/get',
    method: 'get',
    params: { id }
  })
}

export function getPermissionTree(params) {
  return request({
    url: '/oauth/role/getPermissionTree',
    method: 'get',
    params
  })
}

export function getPermissions(params) {
  return request({
    url: '/oauth/role/getPermissions',
    method: 'get',
    params
  })
}

export function getPermsByRoleId(params) {
  return request({
    url: '/oauth/role/getPermsByRoleId',
    method: 'get',
    params
  })
}

export function updatePerms(data) {
  return request({
    url: '/oauth/role/updatePerms',
    method: 'post',
    data
  })
}
